<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.org/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
    <script type="text/javascript" src="/resources/js/jquery-1.12.3.min.js"></script>
</head>
<body>

<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例

    var myChart = echarts.init(document.getElementById('main'));

  $(function () {
      var productName = [];
      var nums = [];
      $.ajax({
          type:"GET",
          url:"/yearcheckrecord/yearcheckrecordList1",
          success:function (result) {
              var yearcheckrecordList=result.data.yearcheckrecords;
              console.log("tttttttt")
              for (var i = 0; i < yearcheckrecordList.length; i++){
                  productName.push(yearcheckrecordList[i].vid)
                  nums.push(yearcheckrecordList[i].money);
              }
              var option = {
                  title: {
                      text: '车辆费用对比'
                  },
                  tooltip: {},
                  legend: {
                      data:['销量']
                  },
                  xAxis: {
                      data: productName
                  },
                  yAxis: {},
                  series: [{
                      name: '费用',
                      type: 'bar',
                      data: nums
                  }]
              };
              // 使用刚指定的配置项和数据显示图表。
              myChart.setOption(option);

          },

      });
      // 指定图表的配置项和数据

  })

</script>

</body>
</html>